﻿using Mapster;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service.Auth.Api.Application.Query;
using Service.Auth.Model.Model.Dto;
using Service.Core.Identity.Model;

namespace Service.Auth.Api.Controller
{
    /// <summary>
    /// 客户端管理 
    /// </summary>

    public class ClientController(
        IMediator mediator, AuthClientQueryService authClientQueryService)
        : BaseController(mediator)
    {

        /// <summary>
        /// 根据clietnId查询client信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Authorize(AuthPolicy.Inner)]
        public async Task<AuthClientDto> InnerQueryClientByClientId([FromQuery] string clientId)
        {
            var result = await authClientQueryService.QueryClientByClientId(clientId);
            return result.Adapt<AuthClientDto>();
        }
    }
}